﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace VRLauncher
{
    class XMLHelper
    {
        public static void XMLSerialize(List<AppItem> config, string filePath)
        {
            XmlSerializer xs = new XmlSerializer(typeof(List<AppItem>));
            Stream stream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
            xs.Serialize(stream, config);
            stream.Close();
        }
        public static List<AppItem> XMLDeserialize(string filePath)
        {
            XmlSerializer xs = new XmlSerializer(typeof(List<AppItem>));
            Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
            List<AppItem> config = xs.Deserialize(stream) as List<AppItem>;

            stream.Close();

            return config;
        }
    }
}
